How can I prevent texture stretching while scaling a mesh?

Any ideas on doing this for UI? When i try this it just crashes when the material is set to UI.