Refactor set_rgui_texture.

More generic and avoids poking directly into RGUI state.