Message Passing Least Squares Framework and Its Applications to Rotation Synchronization