Since you won't draw rectangles anyway (but triangles), I suggest to choose the second option. Furthermore, never trust the user of your program.
The first task is to divide the map into polygons of the same texture. Because your terrain is based on a grid, this can be achieved very easily by a kind of flood fill in combination with a marker algorithm, which runs e.g. like this:
- n := 0 // will be the polygon numbers
- Iterate over each grid cell
- If cell is marked, continue with next cell
- mark cell with n
- check adjacent cells for the same texture and mark them accordingly *
- n := n + 1
* This step can be performed in various ways: FloodFill. Furthermore, you should store an edge cell for each chunk. I.e. a cell that has at least one adjacent cell with a different texture. Let's call this the seed cell.
Then you have your grid marked with the polygon numbers and n is equal to the polygon count.
The next step is to extract the polygons. This is, where the seed cell will be of help. For each chunk, start at the seed cell and run along the edges of the chunk collecting all corner points. These corner points will make your polygon.
After that you have a set of polygons. The final step is to triangulate the polygon for rendering. This can be achieved e.g. with the Ear Cutting / Clipping Algorithm or others.