I am rendering an infinite plane as described in the following answers:
Specifically, I am rendering an "infinite" XZ plane using the following five 4D vertices: $$(0, 0, 0, 1)\quad(1, 0, 0, 0)\quad(0, 0, 1, 0)\quad(-1, 0, 0, 0)\quad(0, 0, -1, 0)$$
In my engine, this is displayed as a ground plane at origin.
What I would like to do is texture this plane. For now, it would be nice to just have a checkered grid. In my fragment shader, I am doing this via the varying $x$ and $z$ positions. This works fine for other "non-infinite" meshes, but for the infinite plane, it is incorrect. This is because the interpolated positions that are passed to the fragment shader don't really make sense in world space, as far as I can tell.
How can I compute the world-space position coordinates in my fragment shader? Is it possible to compute them from the vertex positions, since they represent points at infinity?
The next step would be UV coordinates, but as I understand that might not be possible. I am interested more in being able to easily procedurally texture the plane rather than apply an image to it.