Actually, height is the primary factor.
A standard rack is referred to as a 19" rack. The actual space between the rails is 17 3/4 inches.
The reason that height is most important, though, is that racks are measured in RU (Rack Units), each RU is 1.75" high. Rackmount cases are measured in 'U's, so a 1U server is 1.75", 2U is 3.5" high, 4U is 7", etc.
The most important factor is the hole spacing. Your screw holes have to match the pattern on the rail in order to hold the server in place.
You should be able to find technical documents with exact measurements on various vendors sites. Check
Chatsworth for a sample technical drawing of one common rail. It's an industry standard, so the sizes would be common for other vendors' rails.