Add matrix print function for debug

Prints a matrix's attributes to stdout for debugging
Rename sliceMatrix to matrixSlice for consistency
Copy values when setting XSETing
Improve some code readability
Make XGET return subregion of matrix

Replies with:

* Number of dimensions (dims)
* dims replies for the size of each dimension (shape)
* product(shape) replies for each value
Fix incorrect matrix slicing

Instead of trying to build an array of new values and copying it into
the subregion matrix, just share the variables so that operations on the
subregion will persist.