How to scale a texture to fit the full mesh?

I’m trying to figure out a way to dynamically scale my textures to fit the mesh. In other words, the bounds of the texture should be the Min and Max pixels that have a non-zero alpha. I need to do this without editing the source texture and it needs to work automatically on any texture I pass in. In other words, anything that requires manual adjustment of UVs or scale will not work here.

Is that possible to do with the material system?

maybe you can multiply the u and v with a parameter

Yeah, that’s what I ended up doing, although I was hoping for something that would scale the UVs automatically based on the alpha.