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