The Peirce quincuncial projection is pretty neat. It actually tessellates the whole plane:
Your job is to generate this map projection.
To simplify things, you will only need to generate the northern hemisphere.
Also, you will be given the stereographic projection of the northern hemisphere as input:
Which means all that is left for you to do is to map this disk onto a square in an angle-preserving manner (as described here). (Note: You may assume that the disk touches all four sides of the input image.)
This is code-golf, so the shortest code wins!