[Question]
  [
### Background
*The deltas* of an array of integers is the array formed by getting the differences of consecutive elements. For example, `[1, 2, 4, 7, 3, 9, 6]` has the following deltas: `[1, 2, 3, -4, 6, -3]`.
We will now define the deltas of a matrix of integers as the deltas of each row and each column it contains.
As an example:
```
Row deltas:
1 2 3 4 │ => [1, 1, 1]
4 5 6 7 │ => [1, 1, 1]
7 1 8 2 │ => [-6, 7, -6]
Column deltas (the matrix' columns have been rotated into rows for simplicity):
1 4 7 │ => [3, 3] 
2 5 1 │ => [3, -4]
3 6 8 │ => [3, 2]
4 7 2 │ => [3, -5]
```
Which gives us the following list of matrix deltas:
```
[[1, 1, 1], [1, 1, 1], [-6, 7, -6], [3, 3], [3, -4], [3, 2], [3, -5]]
```
And as we don't want them to be nested, we flatten that list:
```
[1, 1, 1, 1, 1, 1, -6, 7, -6, 3, 3, 3, -4, 3, 2, 3, -5]
```
---
### Task
Your task is to *sum all the deltas* of a matrix given as input. Note that the matrix will only consist of non-negative integers.
### Rules
* All standard rules apply.
* You may assume the matrix contains at least two values on each row and column, so the minimum size will be **2x2**.
* You may take the matrix in any reasonable format, as long as you specify it.
* You *may not* assume that the matrix is square.
* If it might help you reduce your byte count, you *may* optionally take the number of rows and the number of columns as input as well (Looking at you C!).
* This is code-golf, so the shortest code (in bytes), *in each language* wins!
### Test Cases
```
Input  =>  Output
[[1, 2], [1, 2]]                                    => 2
[[8, 7, 1], [4, 1, 3], [5, 5, 5]]                   => -9
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]                   => 24
[[9, 9, 9, 9, 9], [9, 9, 9, 9, 9]]                  => 0
[[1, 3, 14], [56, 89, 20], [99, 99, 99]]            => 256
[[1, 2, 3, 4], [4, 5, 6, 7], [7, 1, 8, 2]]          => 9
[[13, 19, 478], [0, 12, 4], [45, 3, 6], [1, 2, 3]]  => -72
```
  
[Answer]
# [Python 2](https://docs.python.org/2/), 42 bytes
```
lambda m:sum(r[-1]-r[0]for r in m+zip(*m))
```
An unnamed function taking a list of lists, `m`, and returning the resulting number.
**[Try it online!](https://tio.run/##VVDLDoIwEDzrV@wN0CWhUJ4J/kjloFEiiQVS8KA/j7sFjCRtOjud2dm2f4@Prg2nujxPz4u@3i6gi@GlXaN8UflGBVXdGTDQtKCPn6Z3D9rzJubG@zAy7SolEMIKYT4ZqAwhRRCMJZ0IEcMYgdcsYfHCS8snDMlF3nyW5IR@i5ktsbaJKEHa/gm56SoMrJhFdm8CEeRfJs25xAqbvMwvuCd5ZZpxHVAVrsbYNknWB/MbKq/Y73rTtKP9FgSnPDkItcuVN30B "Python 2 – Try It Online")**
### How?
The sum of the deltas of a list is the last element minus the first, everything else just cancels:  
**(r[n]-r[n-1])+(r[n-1]-r[n-2])+...+(r[2]-r[1]) = r[n]-r[1]**
The `zip(*m)` uses unpacking (`*`) of `m` to pass the rows of `m` as separate arguments to `zip` (interleave) and hence transposes the matrix. In python 2 this yields a list (of tuples, but that's fine), so we can add (concatenate) it to (with) `m`, step through all our rows and columns, `r`, perform the above trick for each and just add up the results (`sum(...)`).
[Answer]
# [R](https://www.r-project.org/), 34 bytes
```
function(m)sum(diff(m),diff(t(m)))
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP08jV7O4NFcjJTMtDcjUAdMlQJam5n@gQGJJUWaFRrKGoZWJjomVuY65jqGOhY6Rpo6xjolOCFANAA "R – Try It Online")
Anonymous function. Originally, I used `apply(m,1,diff)` to get the rowwise diffs (and `2` instead of `1` for columns) but looking at [Stewie Griffin's answer](https://codegolf.stackexchange.com/a/142325/67312) I tried it with just `diff` and it worked.
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 33 bytes
```
@(x)sum([diff(x)(:);diff(x')(:)])
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo0KzuDRXIzolMy0NyNaw0rSGMNVB7FjN/2ka0YY6RjrG1mASKAAA "Octave – Try It Online")
### Explanation:
This is an anonymous function taking `x` as input. It takes the difference between all columns, and concatenates it with the difference between the columns of the transposed of `x`. It then sums this vector along the second dimension. 
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
;ZIẎS
```
[Try it online!](https://tio.run/##y0rNyan8/986yvPhrr7g////R0cb6igY6SgY6yiYxOooRJvoKJjqKJjpKJiDeOY6CkBpC6CK2FgA "Jelly – Try It Online")
There are a couple ASCII-only versions too: `;ZIFS` `;ZISS`
[Answer]
# JavaScript (ES6), ~~68~~ 67 bytes
```
m=>m.map(r=>s+=[...l=r].pop()-r[0],s=0)|m[0].map(v=>s+=l.pop()-v)|s
```
### Formatted and commented
```
m =>                              // given a matrix m
  m.map(r =>                      // for each row r of m
    s += [...l = r].pop() - r[0], //   add to s: last value of r - first value of r
    s = 0                         //   starting with s = 0
  ) |                             //
  m[0].map(v =>                   // for each value v in the first row of m:
    s += l.pop() - v              //   add to s: last value of last row of m - v
  ) |                             //
  s                               // return s
```
Because the minimum size of the input matrix is 2x2, `m.map(...)|m[0].map(...)` is guaranteed to be coerced to `0`. That's why it's safe to return the final result with `|s`.
### Test cases
```
let f =
m=>m.map(r=>s+=[...l=r].pop()-r[0],s=0)|m[0].map(v=>s+=l.pop()-v)|s
console.log(f( [[1, 2], [1, 2]]                                   )) // => 2
console.log(f( [[8, 7, 1], [4, 1, 3], [5, 5, 5]]                  )) // => -9
console.log(f( [[1, 2, 3], [4, 5, 6], [7, 8, 9]]                  )) // => 24
console.log(f( [[9, 9, 9, 9, 9], [9, 9, 9, 9, 9]]                 )) // => 0
console.log(f( [[1, 3, 14], [56, 89, 20], [99, 99, 99]]           )) // => 256
console.log(f( [[1, 2, 3, 4], [4, 5, 6, 7], [7, 1, 8, 2]]         )) // => 9
console.log(f( [[13, 19, 478], [0, 12, 4], [45, 3, 6], [1, 2, 3]] )) // => -72
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), 7 bytes
```
dG!dhss
```
[Try it online!](https://tio.run/##y00syfn/P8VdMSWjuPj//@hoQx0FYx0FQ5NYa4VoUzMdBQtLHQUjAxDPEsiC4NhYBQUA "MATL – Try It Online")
### Explanation:
Suppose the input is 
```
[8 7 1; 4 1 3; 5 5 5]
d        % Difference between rows of input
         % Stack:
         % [-4 -6  2; 1  4  2]
 G       % Grab the input again. Stack:
         % [-4 -6  2; 1  4  2]
         % [8 7 1; 4 1 3; 5 5 5]]
  !      % Transpose the bottom element. Stack:
         % [-4 -6  2; 1  4  2]
         % [8 4 5; 7 1 5; 1 3 5]
   d     % Difference between rows. Stack:
         % [-4 -6  2; 1  4  2]
         % [-1 -3  0; -6  2  0]
    h    % Concatenate horizontally. Stack:
         % [-4 -6  2 -1 -3  0; 1  4  2 -6  2  0]
     ss  % Sum each column, then sum all column sums. Stack:
         % -9
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
ø«€¥OO
```
Uses the **05AB1E** encoding. [Try it online!](https://tio.run/##MzBNTDJM/f//8I5Dqx81rTm01N/////oaENjHQVDSx0FE3OLWB2FaAMgzwjIA7FNTHUUgLJmILahjgJQ2Dg2FgA "05AB1E – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 14 bytes
```
+/@,&({:-{.)|:
```
[Try it online!](https://tio.run/##ZY5NCsJADIX3PcVblYq1dn6bDAgeRHEhFnHTA7R3HxOKg1aSbN57X5JXziNOCfvjua2bOR3mbrekqnrcnxNG3CyuFxhYnSI6FQmDiF7GIWj92so4sQOiBAlc7KA2/9eWdzCCRxDD9mBeu6T895XPHX2Jtp8a2cTwA6GHsZoOAsUVzvkN "J – Try It Online")
## Explanation
```
+/@,&({:-{.)|:  Input: matrix M
            |:  Transpose
     (     )    Operate on M and M'
      {:          Tail
        -         Minus
         {.       Head
   ,&           Join
+/@             Reduce by addition
```
[Answer]
# Pyth, 7 bytes
```
ss.+M+C
```
[Try it here.](https://pyth.herokuapp.com/?code=ss.%2BM%2BC&input=%5B%5B8%2C+7%2C+1%5D%2C+%5B4%2C+1%2C+3%5D%2C+%5B5%2C+5%2C+5%5D%5D&debug=0)
My first ever answer in a golfing language! Thanks to [@EriktheOutgolfer](https://codegolf.stackexchange.com/users/41024/erik-the-outgolfer) for -1 byte!
## Explanation
```
ss.+M+C    ~ This is a full program with implicit input (used twice, in fact)
      C    ~ Matrix transpose. Push all the columns;
     +     ~ Concatenate with the rows;
  .+M      ~ For each list;
  .+       ~ Get the deltas;
 s         ~ Flatten the list of deltas;
s          ~ Get the sum;
           ~ Print Implicitly;
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 7 bytes
```
ΣṁẊ-S+T
```
[Try it online!](https://tio.run/##yygtzv7//9zihzsbH@7q0g3WDvn//390tKGOkY6xjkmsTrSJjqmOmY45kGWuY6hjoWMUGwsA "Husk – Try It Online")
-1 thanks to [Mr. Xcoder](https://codegolf.stackexchange.com/users/59487/mr-xcoder) taking my focus away from the `S` and `¤` and towards the `m` (which should've been `ṁ`).  
-1 thanks to [Zgarb](https://codegolf.stackexchange.com/users/32014/zgarb) abusing `S`.
Explanation:
```
ΣṁẊ-S+T 3-function composition
    S   (x -> y -> z) (f) -> (x -> y) (g) -> x (x) (implicit): f x g x
     +    f: [x] (x) -> [x] (y) -> [x]: concatenate two lists
      T   g: [[x]] (x) -> [[x]]: transpose x
 ṁ      (x -> [y]) (f) -> [x] (x) -> [y]: map f on x and concatenate
  Ẋ       f: (x -> y -> z) (f) -> [x] (x) -> [z]: map f on splat overlapping pairs of x
   -        f: TNum (x) -> TNum (y) -> TNum: y - x
Σ       [TNum] (x) -> TNum: sum x
```
[Answer]
# APL, ~~18~~ 15 bytes
```
{-+/∊2-/¨⍵(⍉⍵)}
```
[Try it online!](http://tryapl.org/?a=%7B-+/%u220A2-/%A8%u2375%28%u2349%u2375%29%7D2%202%u23741%2C%202%2C%201%2C%202&run)
[Answer]
# [Haskell](https://www.haskell.org/), 60 bytes
```
e=[]:e
z=zipWith
f s=sum$(z(-)=<<tail)=<<(s++foldr(z(:))e s)
```
[Try it online!](https://tio.run/##lVBLa8MwDL77V@jQQ0IdSDznVer9jR2CD4El1DTpSp1dUvrbM0lNX9BRamxkW/oe0qb226brpqkxlV01YjSj23@5YSNa8Mb/9otgDKLQrNdD7TqKgV8u25/u@4CJVRg24MOpr90ODOwPbjfAAtqqSiR8SEi0lVClmYSilKBiepV4Ox9rAZc4RoLrFWU58v@rZT5BIbCQkKMQYTVGlGVJCbSfMiEwKmfJuVxzeUZXJEPK8j@k0ogk99fNPT182KfIWLwzlXvJNLu5laDvDGPvs@eEbT@MDqHcJikis84Lqo3xpS4sKTNml8HTNOx5QLkS0Wn6Aw "Haskell – Try It Online") Uses the [shorter transpose](https://codegolf.stackexchange.com/a/111362/56433) I found a while ago.
### Explanation
`e` is an infinite list of empty lists and used for the transposing.
`z` is a shorthand for the `zipWith` function, because it is used twice.
```
f s=                                        -- input s is a list of lists
                            foldr(z(:))e s  -- transpose s
                         s++                -- append the result to the original list s
                     =<<(                 ) -- map the following function over the list and concatenate the results
        (z(-)=<<tail)                       -- compute the delta of each list by element-wise subtracting its tail
    sum$                                    -- compute the sum of the resulting list
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 13 bytes
orignally based of [@sundar's design](https://codegolf.stackexchange.com/a/170882/81957)
```
⟨≡⟨t-h⟩ᵐ²\⟩c+ 
```
## Explanation
```
⟨≡      \⟩          #   Take the original matrix and it's transpose 
      ᵐ             #       and execute the following on both
       ²            #           map for each row (this is now a double map "ᵐ²")
  ⟨t h⟩             #               take head and tail
   -                #               and subtract them from each other (sum of deltas in a row)
         c+         #       and add all the values 
                    #           (we have two arrays of arrays so we concat them and sum them)
```
the `⟨⟩` are messing up formatting, sorry
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//9H8FY86FwLJEt2MR/NXPtw64dCmGCAjWfv//@hoQ2MdBUNLHQUTc4tYHYVoAyDPCMgDsU1MdRSAsmYgtqGOAlDYODb2fxQA "Brachylog – Try It Online")
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~22~~ 16 bytes
```
⟨≡{s₂ᶠc+ᵐ-}ᵐ\⟩+ṅ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//9H8FY86F1YXP2pqerhtQbL2w60TdGuBRMyj@Su1H@5s/f8/OtpQR8FYR8HQJFZHIdrUTEfBwlJHwcgAxLMEsiA4NvZ/FAA "Brachylog – Try It Online")
*(-6 bytes inspired by @Kroppeb's suggestions.)*
```
?⟨≡{s₂ᶠc+ᵐ-}ᵐ\⟩+ṅ.       Full code (? and . are implicit input and output)
?⟨≡{       }ᵐ\⟩          Apply this on both the input and its transpose:
    s₂ᶠ                  Get pairs of successive rows, [[row1, row2], [row2, row3], ...]
       c                 Flatten that: [row1, row2, row2, row3, row3, row4, ...]
        +ᵐ               Sum the elements within each row [sum1, sum2, sum2, sum3, ...]
          -              Get the difference between even-indexed elements (starting index 0)
                         and odd-indexed elements, i.e. sum1+sum2+sum3+... - (sum2+sum3+sum4+...)
                         This gets the negative of the usual difference i.e. a-b instead of b-a
                         for each pair of rows
               +         Add the results for the input and its transpose
                ṅ        Negate that to get the sign correct
                 .       That is the output
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt/) `-x`, ~~11~~ ~~10~~ 9 bytes
```
cUy)®än x
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.6&code=Y1V5Ka7kbiB4&input=W1sxMywxOSw0NzhdLFswLDEyLDRdLFs0NSwzLDZdLFsxLDIsM11dCi14)
---
## Explanation
```
c             :Concatenate
 U            :  Input array
  y           :  Transpose
   )          :End concatenation
    ®         :Map
     än       :  Deltas
        x     :  Reduce by addition
              :Implicitly reduce by addition and output
```
[Answer]
# [Factor](https://factorcode.org/) + `math.unicode`, 48 bytes
```
[ dup flip [ [ differences Σ ] map Σ ] bi@ + ]
```
[Try it online!](https://tio.run/##fZLNToQwFIX3PMVxbSRQyk@daNwZN26Mq8ksEEpsZoZBKAsz4Wl8H18J77TYMMSxl7SXJt@5p72t8kIf2vH15en58RZb2dZyh05@9LIuZId9rt/N5Hc616rTqrCbfl@r4lBKNK3U@rNpVa2x8o4eaBwpQjAMbh3w/7jC3T2YgzOkBJ5wTmtkstjEX1IGvhFnpaOJjpGYLCVNcZlm3NHCxbD4Gy4ZD2alI4Tc@k2QCbDAyojpO1OxpeNk4ZzPvKeT@5D8Ly/S4LNjU2kBnmYGCRCyX6WYRBPXjcjI2EtLmTeMa5R9g2qnGqwpSlVVsrX9//7Chvrd2ORNPeAam/G0Qe@h2PrjDw "Factor – Try It Online")
## Explanation:
It's a quotation (anonymous function) that takes a sequence of sequences (matrix) from the data stack as input and leaves a number (sum) on the data stack as output. Assuming `{ { 1 2 3 } { 4 5 6 } }` is on the data stack when this quotation is called...
* `dup` Duplicate an object.
**Stack:** `{ { 1 2 3 } { 4 5 6 } } { { 1 2 3 } { 4 5 6 } }`
* `flip` Transpose a matrix.
**Stack:** `{ { 1 2 3 } { 4 5 6 } } { { 1 4 } { 2 5 } { 3 6 } }`
* `[ [ differences Σ ] map Σ ]` Push a quotation for `bi@` to use later.
**Stack:** `{ { 1 2 3 } { 4 5 6 } } { { 1 4 } { 2 5 } { 3 6 } } [ [ differences Σ ] map Σ ]`
* `bi@` Apply a quotation to two objects. (Inside the quotation now...)
**Stack:** `{ { 1 2 3 } { 4 5 6 } }`
* `[ differences Σ ]` Push a quotation for `map` to use later.
**Stack:** `{ { 1 2 3 } { 4 5 6 } } [ differences Σ ]`
* `map` Take a sequence and a quotation and apply the quotation to each element in the sequence, collecting the results into a new sequence of the same length. (Inside the quotation now...)
**Stack:** `{ 1 2 3 }`
* `differences` Calculate the first-order differences of a number sequence.
**Stack:** `{ 1 1 }`
* `Σ` Sum the elements of a sequence.
**Stack:** `2`
* Now `map` applies the quotation to the next row and the result is also `2`.
**Stack:** `{ 2 2 }`
* `Σ` Sum the elements of a sequence.
**Stack:** `4`
* Thus, the first result of `bi@` is `4`. Now `bi@` repeats the process for its second input (the transposed matrix) and ends up with `9`.
**Stack:** `4 9`
* `+` Add.
**Stack:** `13`
[Answer]
# [SOGL V0.12](https://github.com/dzaima/SOGL), 9 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
```
:⌡-≤H⌡-¹∑
```
[Try it Here!](https://dzaima.github.io/SOGLOnline/?code=JXUyMTkyJTNBJXUyMzIxLSV1MjI2NEgldTIzMjEtJUI5JXUyMjEx,inputs=JTVCJTVCMSUyQyUyMDIlMkMlMjAzJTJDJTIwNCU1RCUyQyUyMCU1QjQlMkMlMjA1JTJDJTIwNiUyQyUyMDclNUQlMkMlMjAlNUI3JTJDJTIwMSUyQyUyMDglMkMlMjAyJTVEJTVE) (`→` added because this takes input on the stack)
Explanation:
```
:          duplicate ToS
 ⌡         for each do
  -          get deltas
   ≤       get the duplicate ontop
    H      rotate it anti-clockwise
     ⌡     for each do
      -      get deltas
       ¹   wrap all of that in an array
        ∑  sum
```
[Answer]
# Mathematica, 45 bytes
```
Tr@Flatten[Differences/@#&/@{#,Transpose@#}]&
```
**Input**
> 
> [{{13, 19, 478}, {0, 12, 4}, {45, 3, 6}, {1, 2, 3}}]
> 
> 
> 
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 19 bytes
```
0q~_z+2few:::-:+:+-
```
Input is a list of lists of numbers. [**Try it online!**](https://tio.run/##S85KzP3/36CwLr5K2ygttdzKykrXSttKW/f//@hoQ2MFQ0sFE3OLWIVoAwVDIwUTIMPEVMFYwQzIMFQwUjCOjQUA "CJam – Try It Online")
### Explanation
```
0       e# Push 0
q~      e# Evaluated input. 
_       e# Duplicate
z       e# Zip (transpose)
+       e# Concatenate. This gives a lists of lists of numbers, where the
        e# inner lists are the original rows and the columns
2few    e# Replace each inner list of numbers by a list of overlapping
        e# slices of size 2. We not have three-level list nesting
:::-    e# Compute difference for each of those size-two slices. We now
        e# have the deltas for each row and column
:+      e# Concatenate all second-level lists (de-nest one level)
:+      e# Sum all values
-       e# Subtract from 0, to change sign. Implicitly display
```
[Answer]
# [APL (Dyalog Classic)](https://www.dyalog.com/), 12 bytes
```
(+/⊢⌿,⊣/)⌽-⊖
```
[Try it online!](https://tio.run/##dVHBSsNAEL33K@aWHWro7maTzfo3oRIJBiJtLlJ6ESkYE9GDfkD9AA/qpSCCnzI/EidtUqvizjIMO@@9fbObnOf@yUWSF6f@NE/m82za0u1DVtDqTrYpZzGeULWm@uOIqqcJUv3uU/XYtiX3FtS80fV6xmVKzebYS5Ms97ji8xndXHnFmbccCVrdCwUatwnhn1WC3kFjsKBQGFAQoAiB4xerhM9nt9ftUIZREQoLMbg/YG12WAd94EGJP7FykA1AGb49gtiBlsxgcLcHAsuG0YEHML0LsJ0PxU6@hy1hsMuyDoyNUUhQeksKmRxhPwl2s1k9WlB1ya@4pHoTQMA/wE1qXpUcU/PivgA "APL (Dyalog Classic) – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `d`, 5 bytes
```
:∩"v¯
```
[Try it online](https://vyxal.pythonanywhere.com/#WyJkIiwiIiwiOuKIqVwidsKvIiwiIiwiW1sxLCAyLCAzXSwgWzQsIDUsIDZdLCBbNywgOCwgOV1dIl0=), or [verify all test cases](https://vyxal.pythonanywhere.com/#WyJkQSIsIiIsIjriiKlcInbCryIsIiIsIltbMSwgMl0sIFsxLCAyXV1cbltbOCwgNywgMV0sIFs0LCAxLCAzXSwgWzUsIDUsIDVdXVxuW1sxLCAyLCAzXSwgWzQsIDUsIDZdLCBbNywgOCwgOV1dXG5bWzksIDksIDksIDksIDldLCBbOSwgOSwgOSwgOSwgOV1dXG5bWzEsIDMsIDE0XSwgWzU2LCA4OSwgMjBdLCBbOTksIDk5LCA5OV1dXG5bWzEsIDIsIDMsIDRdLCBbNCwgNSwgNiwgN10sIFs3LCAxLCA4LCAyXV1cbltbMTMsIDE5LCA0NzhdLCBbMCwgMTIsIDRdLCBbNDUsIDMsIDZdLCBbMSwgMiwgM11dIl0=).
Explanation:
```
:      # Duplicate
 ∩     # Transpose
  "    # Pair
   v¯  # Deltas of each
       # Flatten and sum with the d flag
```
[Answer]
# MY, 9 bytes
```
ωΔω⍉Δ ḟΣ↵
```
[Try it online!](https://tio.run/##y638//9857kp5zsf9QIphYc75p9b/Kht6////6OjLXQUzHUUDGN1FKJNgLSOgjGIaaqjAEKxsQA)
~~Since I cannot ping Dennis in chat to pull MY (due to a suspension), this will currently not work. (`Δ` previously didn't vecify when subtracting)~~
Thanks to whomever got Dennis to pull MY!
## How?
* `ωΔ`, increments of the first command line argument
* `ω⍉Δ`, increments of the transpose of the first command line argument
* , in a single list
* `ḟ`, flatten
* `Σ`, sum
* `↵`, output
[Answer]
## [Pyt](http://github.com/mudkip201/pyt), 11 bytes
```
Đ⊤ʁ-⇹ʁ-áƑƩ~
```
Explanation:
```
          Implicit input (as a matrix)
Đ         Duplicate the matrix
⊤         Transpose the matrix
ʁ-        Get row deltas of transposed matrix
⇹         Swap top two elements on the stack
ʁ-        Get row deltas of original matrix
á         Push the stack into an array
Ƒ         Flatten the array
Ʃ         Sum the array
~         Flip the sign (because the deltas are negative, as subtraction was performed to obtain them)
          Implicit output
```
]