Can a general function that flips the two arguments of Atan2 be found? What is the general form of function $F$ if $F(\operatorname{atan2}(y,x))=\operatorname{atan2}(x,y)$?
In words: I seek a function that flips the order of the two arguments.
By plotting $\operatorname{atan2}(x,y)$ against $\operatorname{atan2}(x,y)$ using points sampled on the unit circle, I discovered these piecewise linear relationships (not surprisingly):
$$
\operatorname{atan2}(x,y)=F(\operatorname{atan2}(y,x))=
\begin{cases}
 -\operatorname{atan2}(y,x)-3\frac{\pi}{2} &\text{if } \operatorname{atan2}(y,x) > -\pi \text{ and } \operatorname{atan2}(y,x) \le -\frac{\pi}{2}, \\
  -\operatorname{atan2}(y,x)+\frac{\pi}{2} &\text{if } \operatorname{atan2}(y,x) > -\frac{\pi}{2} \text{ and } \operatorname{atan2}(y,x) \le \pi.
\end{cases}
$$
Question: Can the above function - which seems to work - be expressed more succinctly using the $\operatorname{sgn}(x)$ function?
I.e., similarly to (see https://en.wikipedia.org/wiki/Atan2):
$$
\operatorname{atan2}(y,x)=\operatorname{sgn}(x)^2 \arctan\left(\frac{y}{x}\right) + \frac{1-\operatorname{sgn}(x)}2\left(1 +\operatorname{sgn}(y)-\operatorname{sgn}(y)^2\right)\pi
$$
Also, is the reverse mapping identical - i.e. if $G(\operatorname{atan2}(x,y))=\operatorname{atan2}(y,x)$, is $G=F$?
 A: Minor quibble : as indicated in the cited Wikipedia article, the standard syntax is that $\text{atan2}(a,b)$ represents the angle in $(-\pi, \pi]$ where $y = a, x = b.$
The idea is that $\text{atan2}(y,x) = F[\text{atan2}(x,y)]$, where the function $F$ will depend on where $\theta = \text{atan2}(y,x)$ is located in the half-open interval
$-\pi < \theta \leq \pi.$
It is presumed that the $\text{atan2}$ function will always return an angle in the $(-\pi, \pi]$ interval and that the result of $F[\text{atan2}(x,y)]$ must also lie in the $(-\pi, \pi]$ interval.
It is also presumed that the case of $(x,y) = (0,0)$ is disallowed.

For simplicity, I will cover the situations where $\theta$ lies on either the $x$-axis or $y$-axis first.  Then, I will cover the situations where $\theta$ is between the axes.

$\underline{\text{Case 1:}}$
If $y = 0, x > 0$, then set
$F[\text{atan2}(x,y)] = \pi/2 - \text{atan2}(x,y).$
Then, when $(x,y)$ is switched into $(y,x)$ the atan2 function will return $\pi/2$, so that the computation will result in $\pi/2 - \pi/2 = 0$ radians, as desired.
$\underline{\text{Case 2:}}$
Similar to Case 1, when $x = 0, y > 0$, then set
$F[\text{atan2}(x,y)] = \pi/2 - \text{atan2}(x,y).$
Then, when $(x,y)$ is switched into $(y,x)$ the atan2 function will return $0$, so that the computation will result in $\pi/2 - 0 = \pi/2$ radians, as desired.
$\underline{\text{Case 3:}}$
When $x = 0, y < 0$, then set
$F[\text{atan2}(x,y)] = \text{atan2}(x,y) - 3\pi/2.$
Then, when $(x,y)$ is switched into $(y,x)$ the atan2 function will return $\pi$, so that the computation will result in $\pi - 3\pi/2 = -\pi/2$ radians, as desired.
$\underline{\text{Case 4:}}$
When $x < 0, y = 0$, then set
$F[\text{atan2}(x,y)] = \text{atan2}(x,y) + 3\pi/2.$
Then, when $(x,y)$ is switched into $(y,x)$ the atan2 function will return $-\pi/2$, so that the computation will result in $-\pi/2 + 3\pi/2 = \pi$ radians, as desired.

I emphasize : 
For the remainder of this response, it is assumed that $(x,y)$ has been switched in to $(y,x)$ and that $\theta = \text{atan2}(y,x)$.  Therefore, $F$ must be constructed so that $F[\text{atan2}(x,y)] = \theta$.
$\underline{\text{Case 5:}}$
If $y > 0, x > 0$, then set
$F[\text{atan2}(x,y)] = \pi/2 - \text{atan2}(x,y).$
Then, when $(x,y)$ is switched into $(y,x)$ the atan2 function will return $\pi/2 - \theta$, so that the computation will result in $\pi/2 - [\pi/2 - \theta] = \theta$ radians, as desired.
$\underline{\text{Case 6:}}$
If $y > 0, x < 0$, then set
$F[\text{atan2}(x,y)] = \pi/2 - \text{atan2}(x,y).$
When $(x,y)$ is switched into $(y,x)$, you will have that 
$\pi - \theta = \text{atan2}(x,y) - (-\pi/2) \implies 
\theta = \pi/2 - \text{atan2}(x,y)$, as desired.
$\underline{\text{Case 7:}}$
If $y < 0, x > 0$, then set
$F[\text{atan2}(x,y)] = \pi/2 - \text{atan2}(x,y).$
When $(x,y)$ is switched into $(y,x)$, you will have that 
$\theta - (-\pi/2) = \pi - \text{atan2}(x,y) \implies 
\theta = \pi/2 - \text{atan2}(x,y)$, as desired.
$\underline{\text{Case 8:}}$
If $y < 0, x < 0$, then set
$F[\text{atan2}(x,y)] = -3\pi/2 - \text{atan2}(x,y).$
When $(x,y)$ is switched into $(y,x)$, you will have that 
$-\pi - \theta = \text{atan2}(x,y) - (-\pi/2) \implies 
\theta = -3\pi/2 - \text{atan2}(x,y)$, as desired.

I deliberately left the analysis split into $8$ cases, to clarify what is happening in each case.  Obviously, you will be able to collapse some of the cases into the same formula.
