How to handle quads?
It sounds like you want to know how to ray trace a bilinear surface patch.

A quick search turned up this page by Ramsey, Potter &amp; Hansen, which includes a paper and, probably better still, source code!

However, if you just want a "cheap and cheerful" hack approach, you could try replacing the quad with 4 triangles. That is, by a new vertex at the 'centre' (i.e. computing the average of the corners) and joining each edge to that new vertex. This is generally produces a better looking, and order-independent result than just using a pair of triangles.