Bug with World Position Offset

I made some code in my material that makes the material always face the camera, but for some reason the shadows glitch out. Anyone have a solution to this?

Code:


Bug Screenshots



:
Details:
The bug only shows up at certain camera angles, and it transitions from the correct shadows to the buggy ones.

If someone could help me I would really appreciate it!