Is this K-map grouping legal?
Yes, K-maps wrap around like this. Moving from the top row to the bottom row is still only changing one bit.
The ones in the corners of your left rectangle are:
$$\overline{WXY}Z + \overline{WX}YZ + W\overline{XY}Z + W\overline{X}YZ$$
You can factor out the \$\overline X\$ and the \$Z\$:
$$\overline{X}Z(\overline{WY} + \overline{W}Y + W\overline{Y} + WY)$$
As you can see, the values in the parentheses cover all possible combinations of \$W\$ and \$Y\$, so they reduce to 1:
$$\overline{X}Z(1) = \overline{X}Z$$