May late entry (called away). Short and sweet I think.
Edit: Ooops, did not read OP closely enough - this works for nXm shapes, not nXmXo...
I'll leave answer for searchers with the former unless OP wants removal. See update below...
xDiag[mat_, {er_, ec_}] :=
SparseArray[{r_, c_} :> mat[[r, c]] /; Abs[r - er] == Abs[c - ec],
Dimensions[mat]]["NonzeroValues"]
Row[{(test = Table[10 x + y, {x, 1, 5}, {y, 1, 5}]) // MatrixForm
, xDiag[test, {2, 3}]}," "]
After discovering the flaw in the above (shape limited to nXm, and fails with zero elements in diagonals) came up with one I like even better. It is shape agnostic, that is, it works with any array shape treating "diagonals" at the top level:
(* cross diagonals *)
Diag2[mat_, {er_, ec_}] :=
Join @@ Cases[
ReplacePart[mat, {r_, c_, ___} /; Abs[r - er] != Abs[c - ec] -> Sequence[]], {__}, {1}]
(* tests *)
Column[{Column[{(test1 = Table[10 x + y, {x, 1, 5}, {y, 1, 5}]) //
MatrixForm, xDiag2[test1, {3, 2}]}, Left, 1],
Column[{(test2 = Array[List, {5, 5}]) // MatrixForm,
xDiag2[test2, {3, 2}]}, Left, 1]
Column[{(test3 = Array[List, {5, 5, 2}]) // MatrixForm,
xDiag2[test3, {3, 2}]}, Left, 1]}, Left, 2]
(* results *)
Reverse
, right? $\endgroup$Reverse
? I posted an answer which does use reverse. $\endgroup$