Questions about cascode current mirror with MOSFETs
The point of a current mirror is the programming of Iout by the gate voltage from an identical device. If Iin flows through M3 it develops a gate voltage which is in common with the gate voltage on M4. As a result Iout through M4 is the same as Iin through M3.
The second current mirror below M3/M4 formed by M1/M2 follows the same principle.
M3 and M4 should be matched. M2 and M1 should be matched. However not all four (M1, M2, M3, M4) need to be matched.