Cascading Rotation of Squares

Here, with the click of a button we can achieve a cascading effect in which each square rotates in a delayed sequence. But the problem[1] here, as opposed to the version with simultaneous rotation of all squares, is that I can't get the squares to rotate around their own center.[2] Getting the grid to rotate all squares in a cascade, each around its own center, is my goal.

[1] StackOverflow. “Strange rotation of rectangle around its center using d3.js” September 2015.

[2] Guido Diepen. “Wrapping my head around D3 rotation transitions” July 11, 2018