This shifts the rectangles upwards instead of cutting off the rectangles, but it keeps the code simple.