The mechanistic basis for diastereoselectivity in the Matteson rearrangement