sort rectangles