Merge "Fix rotation if the shape of display is close to square"