Inferences from the dynamical history of Mercury's rotation