You could do something like this:
Create 2 variables:
If PlayerSprite touches SandSprite Set PlayerLastX to Player.X and PlayerLastY to Player.Y
If PlayerSprite is not touching Sand Sprite:
Set Player position to PlayerLastX & PlayerLastY so that it remains on the SandSprite and can still move where it came from.