Print a matrix in the given pattern.
For this task, the pattern is clockwise spiral order, starting at the top-left cell. Implement the function to return the visited elements as a flat list. The input is a non-empty rectangular matrix of integers, and the output preserves the spiral traversal order.
def spiral_order(matrix):