Click & Drag on the left or right vertices towards that direction; You'll notice if you pull to far, the square will be stopped, & cannot be moved in that direction any longer. (At least not until you pull it back)
All art + code by me; @PIZZA_PLAYER