correct rotation calculation