Require that slice dimensions match array dimensions.  Fixes #4336.

Note that this does not allow trailing dimensions of 1.  Should we?