Added helper functions to move a rectangle to an edge of the screen