Inline the rotate_shape function.