The speedo gear inside the transmission shouldn't slide. The speedo gear should have a clip in it to keep it from moving on the shaft. I would take the tail shaft housing off and see if the clip broke and replace the clip.
Here's a pic of what I'm talking about.