Tile a material with render.SetMaterial & awful shadow bug

I’m making a false panel/wall with an entity that fits to the hole you put it in, yet I’m having an issue. I’m using mesh.TexCoord and mesh.AdvanceVertex to draw the texture, and this apparently causes the material to stretch unnaturally. Should I be using a different method?

As well, I’m having this ghastly shadow glitch, where the shadows randomly become very blurry, then crisp, then blurry, and so on, very rapidly without reprieve. I suspect Atmos might be the culprit, but if anyone else knows of this issue, please let me know!