format.cpp: Add includes so that compiling with python disabled still works
Fix incorrect opening quote in shell_quote
Fix rotation_from_matrix to index through flattened array when building result