Grid snapping with a rotation offset

I asked the question a while back. The guy provided some nice code as an example. I ended up using something different from his but that code helped me get it working correctly.