Some steps were deliberately omitted in the rotation example in the last blog. Most important is the function for the rotation matrix.
The derivation of the formula is fairly simple. One has to solve for y as a function of x which I will leave as an exercise for the reader. To find a rotation that will work for all points one needs to use projection operators to find components in the plane of rotation and those in directions perpendicular which are left unchanged.