This kicked my butt, but I managed to work out a terrain texturing system I'm pretty happy with!
The shader samples from 2 sprite atlases for terrain fill textures and border textures, and layers them on the geometry using different UVs and UV2s, to pick which part of the sheet to render.
I'm usually more of an Array person, but I've been making extensive use (misuse?) of Dictionary data types for the first time; mostly to make lookup tables for mesh data, directionality, what borders have priority over which other borders or what new sprites they should combine into, etc.
Ended up being a fair bit of work up-front, but now it's trivial to add new sprite sheets for new terrain types. Quite pleased with it!


























