Control of structure and spin texture in the van der Waals layered magnet CrSBr