9-Sliced Legacy GUI

For my RTS game, I’d like to draw a selection box with Unity’s legacy GUI in OnGUI since I think it’d be more efficient and simple than constantly turning a UI object on and off and adjusting the size. However, I don’t want the GUI texture to distort from the size of the selection. Is it possible to “9-slice” and draw a texture in OnGUI so that it doesn’t get distorted from resizing?

You can also use DrawTexure() and pass it a GUI style which in turn has the image of a rectangle with a 1 or 2 pixel wide white frame and a Border value of 1 or 2, which would mean that only the pixels of the rectangle which are 1 or 2 pixels from the outside are scaled.

Resizable GUI textures