BreadCrowns
As far as i can see there is nothing wrong with your logic. The pin behavior may not be accurate enough.
Also the detection you are relying on is not ideal either. Part of the problem is that if anything is out on the first rotate then its all compounded from there.
I would suggest a different approach to moving the blocks, more like moving each one a set distance from the center of the current square to the center of the next. This will do away with relying on the collision detection.
When i get a few mins free i will make a capx to show what i mean.