For anyone still wondering, here is the updated code for 1.19.3 with parchment mappings.
public static VoxelShape rotateShape(Direction from, Direction to, VoxelShape shape) {
VoxelShape[] buffer = new VoxelShape[]{shape, Shapes.empty()};
int times = (to.ordinal() - from.get2DDataValue() + 4) % 4;
for (int i = 0; i < times; i++) {
buffer[0].forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = Shapes.or(buffer[1], Shapes.create(1 - maxZ, minY, minX, 1 - minZ, maxY, maxX)));
buffer[0] = buffer[1];
buffer[1] = Shapes.empty();
}
return buffer[0];
}