pub fn rotate90(bits: u64, dim: usize) -> u64
Rotate a square bit grid 90 degrees clockwise. This is an O(1) bitwise operation but conceptually represents rotating the N x N pixel grid.