The way I would do this is with a serie of narrows (keep in mind that narrow never copies the memory so it is very fast):
out = inp
for dim, (b, e) in enumerate(zip(begin, end)):
   out = out.narrow(dim, b, e-b)