I believe this is because OpenGL is column major.

Quick fix is to change this line:
glUniformMatrix4fv(loc3, 1, GLboolean(GL_TRUE), &matrix[0])

But the "right" way too do this is to reorder you matrix so that each column is continuous i.e. rather than


00, 01, 02, 03
04, 05, 06, 07,
08, 09, 10, 11,
12, 13, 14, 15


do


00, 04, 08, 12
01, 05, 09, 13,
02, 06, 10, 14,
03, 07, 11, 15