I finally have a renderer that generates the shapes I want for terrain in one of my game prototypes, completely algorithmically, entirely within the vertex shader! It turned out to only need about 16 lines of code, not counting comments/whitespace. Maybe it took longer than it should have, but at least I can say I thoroughly understand 3d math now.