My question about sign swapping is explained by this blog
https://www.cairographics.org/cookbook/matrix_conventions/
The reason behind this is called pre-multiplication vs post-multiplication technique of matrix transformation.
Post-multiplication
- transformation matrix appears after the position vector matrix
- position vector matrix in homogenous coordinates is represented as a row matrix.
Pre-multiplication
- transformation matrix appears before the position vector matrix
- here the position vectors in homogenous coordinates are represented in column matrix.
Textbook reference: Mathematical elements for computer graphics Rogers/Adams