Edit: I really hope my beautiful ASCII art displays properly. If not, then pretend those are quads.

I'm probably missing your problem in its entirety, so you may need to provide a little more of an explanation if the issue is more complicated.

**With that, I'll provide what information I can:**Keep in mind texture coordinates are subjective to the texture being used. So you'll want to keep them consistent with the orientation of the texture.

Since you're doing terrain tiling, I'll assume you're tiling quads and distorting the height

Texture coordinates range from 0-1, regardless of the model size. Also, keep in mind the OpenGL texture coordinates start at the lower left and increase to the upper right. So (0,0,) represents the lower left corner of the image and (1,1) is the upper right coordinate.

So really all you have to do is start apply that to your model. If you think about your tiles as a quad (instead of two triangles), then you know the coordinates would be:

1 2 3 4 5 6 7
| (0,1) (1,1) _______ | | | | | | |_______| (0,0) (1,0) |

So if we think about how to apply this to a quad made of multiple quads (I believe 8 in your case), then we just need to divide 1 by the number of quads in a certain direction. That would tell you the increment for a given UV coordinate in a particular direction.

For Example:

If you're putting 8 quads together to form your tile, then you can calculate the UV increment with 1/8 (=0.125). Then the current vertex texture coordinate would just be a matter of multiplying 0.125 by the vertex position in the quad (not the actual OpenGL position).

So let's say we want to figure out the U value for one of the 4th vertices from the left.

1 2 3 4 5 6 7
| _______ _______ _______ _______ _______ _______ _______ _______ | | | | | | | | | | | | | | | | | | | | | | | | | | | |_______|_______|_______|_______|_______|_______|_______|_______| ^ We want this one |

Then U = 0.125 * 3.

Of course you would do the same thing with the V coordinate, but you need to make sure the the lowest vertices on the tiles are the 0 value.

**Unwrapping**The above method will indeed work, but it will cause some stretching of the image. However, I still suggest you to try the above method first, as you may not even notice any distortion. The stretching will be a factor of the difference in vertex height.

If you want an accurate UV mapping, then you're going to need to apply some unwrap methods. Now, I've never actually written model unwrapping, but for this case it should be a pretty strait forward method to calculate the length of a vertex in an X or Y direction and then weight it accordingly on a 0-1 scale.