One of the disadvantages of grread is that it doesn't have snap at all.
It is possible to make custom snap functions inside of the grread loop and your code seems to have implemented that in some way, but apparently without implementing the perpendicular snap.
You will have to post the code for anyone to see where this goes wrong.