Suppose, for example, we want to have the y axis show how we are facing.  We want to be at (7,3), facing in direction (ct,st).  The x axis must be orthogonal, (-st,ct).  If we want to express (x,y) in this coordinate frame, we need to take: (ct,st)*(x-7,y-3), and (-st,ct)*(x-7,y-3).  This is done by multiplying by matrix with rows (-st,ct) and (ct,st)