Make texture as X in R and Y in G.
Import as UserInterface2D (e g, uncompressed) and turn off sRGB:
Sample this with a linear color sampler, multiply by 2, subtract 1, add a Y component based on how “flat” you want it to be (1.0 is a good start) and normalize:
Make sure you actually sample with a linear sampler as well!
(an alternative is to calculate the “Z” component based on sqrt(1 - xx - yy) but then there exist invalid values in the input texture that you shouldn’t use, so it depends on your specific input art.)