How to convert Z depth to horizontal distance in image effect shader?

Wow, thank you so much! This is even better than what I was hoping to do. The only problem was that it was still tilting with the camera. Since you wrote it to work on an object too, I realized it was only wrong on the camera itself and line 43 creating the viewSpaceRay just had to be moved down below the lines flipping the uvs. Going through this code helped me finally understand some concepts I was struggling with, thank you again!

In case anyone stumbles onto this from a google search, some useful links for understanding this stuff: