вариант...
function split(src, dist, step, row, column) {
if (row + step < src.length) {
dist.push([
[src[row][column], src[row][column + step]],
[src[row + step][column], src[row + step][column + step]],
]);
if (column + step + 1 < src[0].length) {
return split(src, dist, step, row, column + step + 1);
} else {
return split(src, dist, step, row + step + 1, 0);
}
}
return dist;
}
var arr = [
[1,2,3,4],
[5,6,7,8],
[9,10,11,12],
[13,14,15,16]
];
console.log(split(arr, [], 1, 0, 0));
console.log(split(arr, [], 3, 0, 0));