before rotating X matrix