When we talk about S parameters for a certain number of ports we typically reference each port to a specific impedance, most of the time to one common \$Z_0\$ impedance, but in general terms to a specific \$Z_{0x}\$ impedance where \$x\$ is the port number.
for further references.
The S parameters that I will be using are defined as: \$b = Sa\$
Which in the case of a two port network as shown in the image, this results in \$\begin{pmatrix} b_1\\b_2 \end{pmatrix} = \begin{pmatrix} S_{11} & S_{12}\\ S_{21} & S_{22}\\ \end{pmatrix} \begin{pmatrix} a_1\\a_2 \end{pmatrix} \$
or
\$b_1 = S_{11}a_1 + S_{12}a_2 \$
\$b_2 = S_{21}a_1 + S_{22}a_2 \$
where \$a_x = \frac{V_{x}^+}{\sqrt{2Z_{0x}}} \$ is the incident power wave and \$b_x = \frac{V_{x}^-}{\sqrt{2Z_{0x}}}\$ is the reflected power wave.
Given that the ports are referenced to an impedance, then: \$\Gamma_S = \frac{Z_S - Z_{01}}{Z_S + Z_{01}}\$ and \$\Gamma_L = \frac{Z_L - Z_{02}}{Z_L + Z_{02}}\$.
The S parameters are measured when the ports are loaded or sourcing with their respective reference impedance, this effectively eliminates any reflected wave at the output port.
For instance, for \$S_{11}\$, the load impedance \$Z_{L}\$ should be set to \$Z_{02}\$ which would imply \$a_2 = 0\$ and therefore \$S_{11} = \frac{b_1}{a_1} = \Gamma_{in} = \frac{Z_{in}-Z_{01}}{Z_{in}+Z_{01}}\$ where \$Z_{in}\$ is the impedance seen into the network from port 1.
Similarly for \$S_{21}\$ you would get \$S_{21} = \frac{b_2}{a_1} = \frac{V_2^-}{V_1^+} \sqrt\frac{Z_{01}}{Z_{02}} = \frac{V_2}{V_1} (1 + S_{11}) \sqrt\frac{Z_{01}}{Z_{02}}\$
For \$S_{12}\$ and \$S_{22}\$ the procedure is effectively the same.
The only thing left to do is solve the circuit inside the network and compute the parameters, this however requires to know what exactly is inside that [S] box.
In many cases you are simply given the S parameters with their respective reference impedances (usually at a number of frequencies) without actually giving you the circuitry inside the [S] box, this made me think if there was a way to determine what would go on should I connect a set of different impedances to each port. In other words, could I recompute the S parameters for a new set of impedances on the same network without knowing how said network is built.
A possible way of going about this is to keep the source impedance at \$Z_{01}\$ but change the load impedance to something else, this would allow me to rewrite \$\Gamma_{in}\$ as \$\Gamma_{in} = S_{11} + \frac{S_{12}S_{21}\Gamma_L}{1-S_{22}\Gamma_L} = \frac{Z_{in}-Z_{01}}{Z_{in}+Z_{01}}\$ I could then solve for \$Z_{in}\$ and compute my new \$S_{11}'\$ as \$S_{11}' = \frac{Z_{in}-Z_{S}}{Z_{in}+Z_{S}}\$ (now \$Z_{S}\$ is no longer \$Z_{01}\$).
The idea is the same for \$S_{22}'\$, albeit you would set port 2 to \$Z_{02}\$ and change at what's at port 1 to some other impedance, compute \$Z_{out}\$ from \$\Gamma_{out} = S_{22} + \frac{S_{12}S_{21}\Gamma_S}{1-S_{11}\Gamma_S}\$ and have your \$S_{22}' = \frac{Z_{out}-Z_{L}}{Z_{out}+Z_{L}}\$ where now \$Z_{L}\$ is no longer \$Z_{02}\$.
This works great for \$S_{11}'\$ and \$S_{22}'\$ but can't seem to find a way to determine \$S_{21}'\$ and \$S_{12}'\$ as this forces me to change the impedance on both ports and could no longer use the given S parameters. Thinking that this might simply not be possible I found this out which apparently is capable of computing for what I'm asking (although it does it assuming that all ports have to be referenced to the same impedance).
So it seems that finding \$S_{21}'\$ and \$S_{12}'\$ is possible, how can it be done?