[Question]
  [
### Input:
* An integer `n`
* Two equal-sized square matrices (with their width/height being a multiple of `n`)
### Output:
One of two distinct values of your own choice, one being for truthy results and one for falsey results (so yes, `1/0` instead of `true/false` are valid outputs for languages like Java, even though [they're not considered official truthy/falsey values](https://codegolf.meta.stackexchange.com/a/2194/52210)).
The truthy/falsey output indicates whether we can rearrange blocks of size `n by n` in one matrix to make it equal to the other matrix.
### Example:
Input:
```
Matrix 1:
1 2 3 4 5 6
7 8 9 0 1 2
3 4 5 6 7 8
9 8 7 6 5 4
3 2 1 0 9 8
1 1 1 1 1 1
Matrix 2:
3 2 9 8 7 8
1 1 1 1 5 4
3 4 5 6 1 0
9 0 7 6 1 1
5 6 1 2 3 4
1 2 7 8 9 8
Integer n:
2
```
Output: `truthy`
**Why?**
If we split the matrices in blocks of `2 by 2`, we can see that all blocks on one matrix can also be found in the other matrix:
```
Matrix 1:
1 2 | 3 4 | 5 6
7 8 | 9 0 | 1 2
---------------
3 4 | 5 6 | 7 8
9 8 | 7 6 | 5 4
---------------
3 2 | 1 0 | 9 8
1 1 | 1 1 | 1 1
Matrix 2:
3 2 | 9 8 | 7 8
1 1 | 1 1 | 5 4
---------------
3 4 | 5 6 | 1 0
9 0 | 7 6 | 1 1
---------------
5 6 | 1 2 | 3 4
1 2 | 7 8 | 9 8
```
## Challenge rules:
* You can assume the matrices will only contain non-negative digits (range `[0,9]`)
* You can assume the width/height of the matrices are equal, and a multiple of `n`
* You can assume `n` will be in the range `[1, 50]`, and the width/height of the matrices are in the range `[1,100]`.
* The individual blocks of `n by n` can only be used once to determine if the matrices are permutations of each other when split into blocks of `n by n`.
* There can be multiple `n by n` blocks that are the same.
* The `n by n` blocks will remain in the same orientation when checking if the two matrices are permutation of each other when split into blocks of `n by n`.
## General rules:
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer in bytes wins.  
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
* [Standard rules apply](https://codegolf.meta.stackexchange.com/questions/2419/default-for-code-golf-program-function-or-snippet/2422#2422) for your answer with [default I/O rules](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/), so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
* [Default Loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are forbidden.
* If possible, please add a link with a test for your code (i.e. [TIO](https://tio.run/#)).
* Also, adding an explanation for your answer is highly recommended.
## Test cases:
```
Input:
Matrix 1:       Matrix 2:       Integer:
1 2 3 4 5 6     3 2 9 8 7 8     2
7 8 9 0 1 2     1 1 1 1 5 4
3 4 5 6 7 8     3 4 5 6 1 0
9 8 7 6 5 4     9 0 7 6 1 1
3 2 1 0 9 8     5 6 1 2 3 4
1 1 1 1 1 1     1 2 7 8 9 8
Output:
truthy
Input:
Matrix 1:       Matrix 2:       Integer:
1 2 3 4 5 6     3 2 9 8 7 8     1
7 8 9 0 1 2     1 1 1 1 5 4
3 4 5 6 7 8     3 4 5 6 1 0
9 8 7 6 5 4     9 0 7 6 1 1
3 2 1 0 9 8     5 6 1 2 3 4
1 1 1 1 1 1     1 2 7 8 9 8
Output:
truthy
Input:
Matrix 1:       Matrix 2:       Integer:
1 2 3 4 5 6     3 2 9 8 7 8     3
7 8 9 0 1 2     1 1 1 1 5 4
3 4 5 6 7 8     3 4 5 6 1 0
9 8 7 6 5 4     9 0 7 6 1 1
3 2 1 0 9 8     5 6 1 2 3 4
1 1 1 1 1 1     1 2 7 8 9 8
Output:
falsey
Input:
Matrix 1:    Matrix 2:    Integer:
1 2 3 4      1 2 3 4      4
2 3 4 5      2 3 4 5
3 4 5 6      3 4 5 6
4 5 6 7      4 5 6 7
Output:
truthy
Input:
Matrix 1:    Matrix 2:    Integer:
1 2 3 4      3 4 3 4      2
2 3 4 5      4 5 4 5
3 4 5 6      1 2 5 6
4 5 6 7      2 3 6 6
Output:
falsey
Input:
Matrix 1:    Matrix 2:    Integer:
1 2          2 3          1
3 4          1 1
Output:
falsey
Input:
Matrix 1:    Matrix 2:    Integer:
0            8            1
Output:
falsey
Input:
Matrix 1:    Matrix 2:    Integer:
1 2 3 4      1 2 1 2      2
5 6 7 8      5 6 5 6
9 0 0 9      0 9 9 0
4 3 2 1      2 1 4 3
Output:
falsey
Input:
Matrix 1:    Matrix 2:    Integer:
1 2 1 2      9 5 1 2      2
3 4 3 4      7 7 3 4
8 3 9 5      1 2 8 3
6 1 7 7      3 4 6 1
Output:
truthy
Input:
Matrix 1:      Matrix 2:      Integer:
1 0 2 0 0 3    1 1 1 0 0 3    2
1 1 1 1 1 1    2 0 1 1 1 1
2 2 2 2 2 2    2 2 2 2 2 2
3 3 3 3 3 3    3 3 3 3 3 3
4 4 4 4 4 4    4 4 4 4 4 4
5 5 5 5 5 5    5 5 5 5 5 5
Output:
falsey
```
[Pastebin with matrices in `[[,]]` format.](https://pastebin.com/DPZaACL9)
  
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), ~~19~~ ~~18~~ 17 bytes
-2 thanks to ngn.
Anonymous tacit infix function. Takes `n` as left argument and list of two matrices as right argument. Requires zero-indexing (`⎕IO←0`). Incidentally, this function works on arrays of any number of dimensions.
```
≡.{∧,⍵⊂⍨⊂0=⍺|⍳≢⍵}
```
[Try it online!](https://tio.run/##jVM9SwNBEO3zK7ZLM5HdvW/BysYIGjB2R4rDXEQIKiZFRG0Ugglc0MIfoI12FmJj6U/ZP3LO7G7MoblLOLjbnZ157@3Mu@S83@heJv2z40Y6Gqan3bSbq9lTs6XGDzxXk@eNK3X/Cir7VNNblb3hm2@p7OtaZR9q8oLxm7yHuSqbmbLp3fe7o8aPuGsfbOP7cKfZzuuH6WDIjpJBOmACmATmbNZre8nw4mQkqFwX7LZb@/U4FiDBARc88DsQBxBCBBwwijsbB4ziLsKzAHceuPpMYhbHbDoT8Pt0OnMu@ZeLagxKsWaOZ7gQU3NxzUV4EJu41qnrJBidIXFJ1mP2bvYra2JJzFkSqy1axVxg3so2Ib1t10IyrmybSI77j0aUt8O1mFRvMInHYBKPj6uSKxal@5W6jdKKsSCTGQfliBVcQTkXr@Lw1gEP1xlA0ZGcHKgbqP1YIUBov0pbb1pM7o203@gMMdZpdlStcfHnGLUhfiM9WvJwYExSohHzbD3mFdwe6gERpm/uuETjDw "APL (Dyalog Extended) – Try It Online")
`≡.{`…`}` identical results of the following function applied to each matrix `⍵` with `n` as `⍺`?
 `≢⍵` size of matrix
 `⍳` indices 0…size–1
 `⍺|` division remainder when divided by `n`
 `⊂` enclose to use along all dimensions
 `⍵⊂⍨` use that to partition\* the matrix into a matrix of submatrices  
  \* begins new partition when corresponding element is less than the previous; removes elements marked by zero
 `,` ravel the matrix into a list of submatrices
 `∧` sort ascending
[Answer]
# [Python 2](https://docs.python.org/2/), ~~108~~ 103 bytes
```
lambda s,*a:len(set(`sorted(sum([zip(*[iter(zip(*l))]*s)for l in zip(*[iter(m)]*s)],[]))`for m in a))<2
```
[Try it online!](https://tio.run/##hVLLboMwELzzFRxttAfs8Kyaa2/ceqNIoQpRkYBEQA7tz9PdNQ8noqo4YM/Ozj7Gt@/x69rp6XL8mJqy/TyX7gBe@dJUnRiqUZyGaz9WZzHcW5H/1Dfh5fVY9YKPjZSFN8jLtXcbt@5cK95ypIC8kPJEhJYIpZSvesrUMc8VaDhAACFEyIohgRR8QBRvMw6I4i3FWIy3EAKOaWT5yKaYgvUrCifTKEwEk2ITlmQjjAIs7LMwJUNucG6K8zSYphIUdm593Y3uRWjIFGRauvDe36sVVvvwYYXfymaoHMeeHIvMG9gaw9M8@TZNMJMpYMgkYMgkEOHJ6jDgmuq5Ff1XK6b4Ug4FzdJsSbWb66854f/kbWbbV5985NHY1UVQscV6JptJyfCUXaMYJuy78lxze0@meoL/lJdIZsfbnhGcyQhabyDhhZBA9LiUx5cw/QI "Python 2 – Try It Online")
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~94 68~~ 63 bytes
```
{[eqv] map *.rotor($^a).map({[Z] $_}).flat.rotor($a²).sort,@_}
```
[Try it online!](https://tio.run/##nVLLaoRAELz7FX1YgoZG1PVJCOQ7MkzEw3raxV1XAov4U/mE/Jjph67DkkOIHpyZ6qrqnvJ86I/5fLrBUwuvMI/mcPm0cGrO8Bz23dD1/u6jCUI68EfzbmFXT0HYHpthRZvvryC8dv2Ab/U0t10PCca4h9EDuDY3aP1djcaYGBPcY4oZ5hZNgSVWGFFlQrvlHOmUdhVhBe0yTAVjvYiqGYvx/lqLZKGPkTIlumWrhMqTjMhHIs8SaPRcWhNegtpaaa0NvMnzdIZ09domofJlos2CVsskTnd/ZtjgZfVL8B9Geg/pwmFcOayjHNbJaeVaxYuVij/IEUGv06WAUCIqpYKMkDvw0LabacQZSluS6OajBG0gk9i5Uw68krwYI9KvNtvvo4YlfSuZmVMt3Nsx1EO2EAhwAi9lRhbJZc75Bw "Perl 6 – Try It Online")
Anonymous code block that takes input as `size, [matrix1, matrix2]` and returns a boolean `True/False`. There might be a more efficient way of splitting the matrix into chunks than `rotor`.
### Explanation:
```
{                                                            }  # Anonymous code block
       map                                                ,@_   # For both matrices 
           *.rotor($^a)   # Split the matrix into N sized chunks
                       .map({[Z] $_})  # Then zip each of those chunks together
                                     .flat  # Flatten the resulting list
                                          .rotor($a²)  # Then split into the NxN lists
                                                     .sort   # And sort them
 [eqv]    # And then check if the lists are equivalent 
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 14 bytes
```
εε²ô}ø˜²ô²ô{]Ë
```
[Try it online!](https://tio.run/##yy9OTMpM/f//3NZzWw9tOryl9vCO03NADBCujj3c/f9/dHS0oY6BjhEQG@gYx@oAeXAI5BnpwCGQZ6wDhUC2iQ4cAnmmOnAYC@RCTYGZCTKdQjNjuYwA "05AB1E – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~10~~ 9 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ż⁹/ẎsṢʋ€E
```
**[Try it online!](https://tio.run/##y0rNyan8///onkeNO/Uf7uorfrhz0anuR01rXP///x8dHW2oo2Cko2Cso2Cio2Cqo2AWy6WgE22uo2Cho2Cpo2CgowBSABZEqNFRACkAC1qCVZqDBYFSJjCVRmCNBmBDICoNwSIIFBvLpRMNVQo3BVMpsqFw60FGw6w3gFkPNhQkCFcD9RjMTCOIFVA3xcb@NwIA "Jelly – Try It Online")** (or [with pre-processing](https://tio.run/##y0rNyan8///onkeNO/Uf7uorfrhz0anuR01rXP8/3L3l4Y5NQKb/sXYgGXZopeHD3d0Pd646tO7oJA@gSNShJYeX//9vqGCkYKxgomCqYKYAAsZAvqWChYI5EIOAEReIZalgoABSCQKGUGiqYMIF0wlTDeMbKhhwQUwxA6kDy4HMMAfLGXKBbAGqAdsEAhA9YJdwGSogIMQ@IwWIGywA "Jelly – Try It Online") for easier copy & paste from the test cases)
A dyadic Link accepting a list of the two matrices (as lists of lists) on the left and the integer on the right which yields `1` or `0` for truthy or falsey respectively.
### How?
```
ż⁹/ẎsṢʋ€E - Link: [M1, M2]; N
       €  - for each of [M1, M2]:
      ʋ   -   last four links as a dyad (i.e. f(M, N)):
 ⁹        -     (chain's right argument, N)
 ⁹/       -     N-wise-reduce with:
ż         -       zip together
   Ẏ      -     tighten
    s     -     split into chunks of length N
     Ṣ    -     sort
        E - equal?
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 18 bytes
```
®mòV yòV rc n qÃr¥
```
[Try it online!](https://ethproductions.github.io/japt/?v=1.4.6&code=rm3yViB58lYgcmMgbiBxw3Kl&input=W1tbMSAyIDMgNCA1IDZdCls3IDggOSAwIDEgMl0KWzMgNCA1IDYgNyA4XQpbOSA4IDcgNiA1IDRdClszIDIgMSAwIDkgOF0KWzEgMSAxIDEgMSAxXV0KW1szIDIgOSA4IDcgOF0KWzEgMSAxIDEgNSA0XQpbMyA0IDUgNiAxIDBdCls5IDAgNyA2IDEgMV0KWzUgNiAxIDIgMyA0XQpbMSAyIDcgOCA5IDhdXV0KMgotUQ==)
Explanation:
```
®              Ã      #Apply this to each of the input matrices:
 mòV                  # Split each row into groups of n
     yòV              # Split each column into groups of n
         rc           # Flatten into a list of nxn submatrices
            n         # Sort that list
              q       # Turn it into a string
                r¥    #Return true if both matrices had identical results
```
The "Turn it into a string" step is necessary because Japt [doesn't compare arrays by value](https://ethproductions.github.io/japt/?v=1.4.6&code=WzEsMl09PVsxLDJd&input=) and the builtin to work around that [doesn't work for multidimensional arrays](https://ethproductions.github.io/japt/?v=1.4.6&code=W1sxLDJdLFszLDRdXWVbWzEsMl0sWzMsNF1d&input=). 
[Answer]
# TSQL, 164 bytes
Populating a table variable in order to have input, this creating input and inserting data has not been included in the byte count. Only the actual query to extract the data.
Golfed(not including test table - it can be found in the ungolfed version):
```
SELECT iif(exists(SELECT*FROM(SELECT string_agg(v,'')within
group(order by x,y)s,m FROM @t GROUP BY x/@,y/@,m)x
GROUP BY s HAVING max(m)=min(m)or sum(m-.5)<>0),0,1)
```
Ungolfed:
```
-- test data
DECLARE @ INT = 2
-- x = x-position of the input
-- y = y-position of the input
-- v = value
-- m = matrix(0 or 1)
DECLARE @t table(x int, y int, v int, m int)
--insert first matrix values
INSERT @t values
(0,0,1,0),(0,1,2,0),(0,2,1,0),(0,3,2,0),
(1,0,3,0),(1,1,4,0),(1,2,3,0),(1,3,4,0),
(2,0,8,0),(2,1,3,0),(2,2,9,0),(2,3,5,0),
(3,0,6,0),(3,1,1,0),(3,2,7,0),(3,3,7,0)
INSERT @t values
(0,0,9,1),(0,1,5,1),(0,2,1,1),(0,3,2,1),
(1,0,7,1),(1,1,7,1),(1,2,3,1),(1,3,4,1),
(2,0,1,1),(2,1,2,1),(2,2,8,1),(2,3,3,1),
(3,0,3,1),(3,1,4,1),(3,2,6,1),(3,3,1,1)
-- query
SELECT iif(exists
  (
    SELECT *
    FROM
    (
      SELECT string_agg(v,'')within group(order by x,y)s,m
      FROM @t
      GROUP BY x/@,y/@,m
    ) x
    GROUP BY s
    HAVING max(m)=min(m)or sum(m-.5)<>0
  ),0,1)
```
**[Try it out](https://data.stackexchange.com/stackoverflow/query/965629/matrix-jigsaw-puzzles)**
[Answer]
# JavaScript (ES6), 88 bytes
```
(n,a,b)=>(g=a=>a.map((r,y)=>r.map((v,x)=>o[y/n<<7|x/n]+=[v]),o=[])&&o.sort()+o)(a)==g(b)
```
[Try it online!](https://tio.run/##3VPbasJAEH3vVwQKuotTzcXciutX9C3sw2qjtNisJCIK/fd0ZjfGtNZU6JvMQzK3M3OGs@9qr6pl@bbdPRX6Na9XomYFKFhwMWdrocRcjT/UlrESjhgqrbOHAzo6O06K2Sz@PEwKORLZXnLQIpN8MNDjSpc7xkeaM8WFWLMFr5e6qPQmH2/0mg1f8mrnLFWVO4@e8@wMnZGzYj44WeaBDwFMIYRIQhZDAim4gFH0mjhgFL0UczF6IUxNzscqF6sp50FrUhIspW1DN31qtbDYbmBdA0utkNm4Wcn0@WBXSqTk/OEaJ7/l5N0Np6DlFNwNp2nLadrhhAANt/NQ/Gs42T1vLO2ZHf6q@1tmU9iWUtiWUrstpfYI//pmRxf6tNMsPiLY2/dixN8xXNvbf@/kGueuWlxShyFntHK@t10zNFIipiSi1GiBcljeOzu9nH1Wq90iwW9qzkliik/3xlBTiqGOwhJzJ2qP/riV5/6Y7WI78Qx@vAGi0poBb8zcozVzhtZOF/LMw7KgvnmM/wLlvP4C "JavaScript (Node.js) – Try It Online")
### How?
This code is:
* extracting all sub-matrices in each input matrix as a concatenation of cells
* sorting the sub-matrices in lexicographical order
* testing whether the result is the same for both input matrices
It is taking advantage of the limits described in the challenge:
* A matrix consists of single digits, so we can just concatenate all cells of a sub-matrix without any separator and still get a unique representation of it (e.g. `[[1,2],[3,4]]` can be stored as `"1234"`).
* The width of the input matrices is less than or equal to \$100\$. To convert the coordinates \$(x,y)\$ in an input matrix into a unique slot index \$I\$ in our storage area, we can do:
$$I=\left\lfloor\frac{y}{n}\right\rfloor\times128+\left\lfloor\frac{x}{n}\right\rfloor$$
or as JS code: `y / n << 7 | x << n`
### Commented
```
(n, a, b) =>           // n, a, b = input variables (integer, matrix 1, matrix 2)
  (g = a =>            // g = helper function taking one of the two matrices
    a.map((r, y) =>    // for each row r[] at position y in a[]:
      r.map((v, x) =>  //   for each value v at position x in r[]:
        o[             //     update o[]:
          y / n << 7 | //       the position of the slot is computed by taking advantage
          x / n        //       of the limit on the matrix width (see above)
        ] += [v]       //     coerce v to a string and append it to o[slot]
                       //     all slots are initially undefined, so all resulting strings
                       //     are going to start with "undefined", which is harmless
      ),               //   end of inner map()
      o = []           //   start with o = empty array
    ) &&               // end of outer map()
    o.sort() + o       // sort o[] and coerce it to a string by concatenating it with itself
  )(a) == g(b)         // test whether g(a) is equal to g(b)
```
[Answer]
# [Java (JDK)](http://jdk.java.net/), 217 bytes
```
(n,a,b)->{java.util.Arrays A=null;int l=a.length,x=l/n,j=0,z;var c=new String[x*x];A.fill(c,"");var d=c.clone();for(;j<l*l;d[z]+=b[j/l][j++%l])c[z=j/l/n+j%l/n*x]+=a[j/l][j%l];A.sort(c);A.sort(d);return A.equals(c,d);}
```
[Try it online!](https://tio.run/##vVRLb6MwEL73V1hIlaA41OaNKJVy2dueekQcDIEW1pgsmG7aKr89OzakXfWhvXWk@DHzzXwzQzwde2Sbbvfr1Pb7YZSog7szy5Y7V@nFB10zi0q2g1DGirNpQj9ZK14uEGqFrMeGVTX6gdQdoXIYeM0EakywIYFhzYu8YOdDaaWAO8Jvkky2FTg2KDuZAjNcWpvblzfa7TiypwltMzFznqpwPGMOr8W9fMCHjF8L3GUEP6ePbERVJuo/6E6OrbjPD1eHIt06Tcu5WWHDsDRkl1VOxQdRm1baDKOZdjf8iqe7/LmwszLvrnmRd7Z9yQuryp8zuF8Lu7uEFcLZGVsRYIfYE7TIrKzzaWelYy3nUaCtU/@eGZ@AGJTHkyp3P5ccSl0rfhzaHeqhg@aaboHYeD9ZawdlPUnTxcigrucHIY7ihFAXq3MU4ySOwsDHnktJEmOqxQCw54JlUSgzgCnBCYlCSjGcIRSmLoSKDf0BVhr6PTTe99D4Kw1WVNoLKxrjC/W/ru7Xrp4Paj8ANXVB7Xph@EkPwUeBXQ@S/mAmyhR/Trj0gZAE@9CGJVcIF4TARZKEYJf63ieumhL8Yy8JcEgjnWsSgDqKdHtiDwAh/ehKXEK8tdnY1YI9LdjXggMtOhdKFdgl/wW/f9f6X65Jl0Gwvk3EXk@l9W5mjPU0c4ky1DgNDASI1JvMWvbSWuu4e5pk3TvDLJ09hJFcmIvf@wTWgaO9V8bXN6bGwQGIJmfa81aaBj636ezVg1VNFHU/rEMH9AtITQ9VVQsgksJ2g84YuNn2mQahPm8LAB1gc6oHNk6m5fRsb1ab22rjx5YjBz3mzJX@qNd1lPRLRcfTXw "Java (JDK) – Try It Online")
## Explanation
The idea is to pick each small cell as a string, which is comparable, and then to sort those strings and compare them in order.
```
(n,a,b)->{
 java.util.Arrays A=null;             // Shortcut A for the several java.util.Arrays that'll come
 int l=a.length,x=l/n,i=0,j,z;        // Variable declarations
 var c=new String[x*x];               // Declare the small squares list
 A.fill(c,"");                        // Fill the lists of small squares with the empty string.
 var d=c.clone();                     // Make a copy of the list, for the second matrix
 for(;i<l;i++)
  for(j=0;j<l;d[z]+=b[i][j++])        // For each matrix cell
   c[z=i/n+j/n*x]+=a[i][j];           // Fill the small square with the value, string-wise
 A.sort(c);A.sort(d);                 // Sort both small squares list
 return A.equals(c,d);                // Return true if they're equal, false otherwise.
}
```
Note: some lines are obsolete.
## Credits
* -12 bytes thanks to Kevin Cruijssen!
* -4 bytes thanks to ceilingcat.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~54~~ 49 bytes
```
1ＦθＦ⪪ιηＦ÷Ｌ§κ⁰η⊞υＥκ§⪪μηλＷ∧υ⊟υ¿№✂υ⁰⊘⊕Ｌυ¹ι≔Φυ⁻⌕υιλυ⎚
```
[Try it online!](https://tio.run/##TU7fa4MwEH7vX3H0KYEbqGvXlj6VjrHCBkIfxQfRtB5No9Po9t@7S2LHIiHe9@u@si66sin0NKUdGSuW8VLuF5emA/Elwb/nVpMVhFDLGTkZ@0ojVUp8KHO1tTjYk6nUj7ghRFIGZTr0tRgQPovW4Q9JSLs7DYKWkrd916QViIOpnD5tWjEwDnQBcWwGLnXWVCrHRQjvhR5VxRXKTt2Vsfw/l3AmhJgvsfvQ93Q14o20VZ3vQWboeQ5bKGxHGOQelO4VHLUqOiH305TxiTHBZ1zhGl9yzDa4xR1GyChPM46M8rRjbsPTGleeS1gVsdpxMf59eY4LgMwLguW/4GEOwRzggyMf7MyYBdyX8r4EQ6lt7pOTfHoa9S8 "Charcoal – Try It Online") Link is to verbose version of code. Takes input as an array of equal-sized two-dimensional arrays. Outputs 1 on success, nothing on failure. Explanation:
```
1
```
Assume success.
```
Ｆθ
```
Loop over the arrays.
```
Ｆ⪪ιη
```
Divide the array into `n`-sized row chunks.
```
Ｆ÷Ｌ§κ⁰η
```
Loop over each column chunk.
```
⊞υＥκ§⪪μηλ
```
Extract the column chunk for each row of the row chunk and save the resulting submatrix in a list.
```
Ｗ∧υ⊟υ
```
While the list is nonempty, remove the last chunk of the list, which under normal circumstances comes from the second array.
```
¿№✂υ⁰⊘⊕Ｌυ¹ι
```
Count the number of occurrences of that chunk in the first half of the list, which under normal circumstances contains the remaining chunks from the first array.
```
≔Φυ⁻⌕υιλυ
```
If nonzero then remove the first occurrence of that chunk from the list.
```
⎚
```
If zero then clear the output, making it falsy.
[Answer]
# [J](http://jsoftware.com/), 55 bytes
```
[:-:/[([:/:~([*-@[)]\,@])"3(((;])@(#@]$1{.~[),;.1])&>])
```
[Try it online!](https://tio.run/##ZU/LTsMwELz7K0alojZK0qRx08RRUSQkTj1xNT4kiApx4QOQ@uth1w9ChC0/ZndnZ@dz3hS7K84GO2QoYejkBZ5eLs@zNbnZW2nN3tykfcgHq9xrNji1qaWUvVODvBvctvoublZlfVE5df/o1KwExHg2DRpsUeGAGhpHQie06Ejgf6yltyGsKX6gfOlj1bLFlBpyQSAsBYEYGgZy6RuGXPMryG8UFOL97eOL8BVjPwVQRxCQ9mgU7IWA/mMmjZ80oxUeMlbWcSLtZzt6Jtcwk3ysxcWIlUSS4dPS3UUTJ9q0xLSUd7E3p5JDpvCfKCud@Qc "J – Try It Online")
A horrible solution, just made it work - I have no power to golf it...
[Answer]
## Haskell, ~~74~~ 73 bytes
```
import Data.Lists
i#m|c<-chunksOf i=c.transpose=<<c m
(m!n)i=i#m\\i#n==[]
```
Note: TIO hasn't installed `Data.Lists`, so I'm using `Data.List` instead an add the missing function `chunksOf`: [Try it online!](https://tio.run/##3VNNi8JADL3PrxhxDwpZaetXu9jbHhf2B4xlKVVx0E5L24U97H/vJplaxRaUxZMGdCbJy0vim31cHrbHY13rNM@KSr7HVTz50GUl9DD9TVavyf7bHMrPndRhMqmK2JR5Vm7D1SqRqRilAzPWIaau13powlBFdQv4kiqSIX6J1mXkT4muKj5s7flNXsRGmyLL2T8WYod5owEe0lgbPG8yIWVeaFPJF7mTSrngwRRmMIdFBGoJPgTgAHrx1vgBvXgLMLbE2xxmHPMwy8FsirnQWhQhw/mjONNiLzNPVSwDVmIGhxmoCijr5@4Y54Htzr9i8MTTjeQ@30hTIftnQlQz25kJT81MnT7/g5qJh1BThkVRhkVRJYuiSgs8dcXZJbd0HQIsYXd/Sw5OB3qvgpp/7KQVh7TBA7FSerdt@52zpmhQUlPASqAYIu95j2ep2iZ8/A14gySfZc@2MdqgMHohL5@XRJUWnYZ7qB2E0JTTK/1T961xwcZ4G63x5K317Mfl92Xre/wmH1ffq/8A "Haskell – Try It Online")
```
i#m=           -- function '#' makes a list of all transposed jigsaw blocks of matrix 'm'
               -- of size 'i'
 c<-chunksOf i -- define helper function 'c' that splits it's argument into
               -- chunks of site 'i'
         c m   -- split the matrix into chunks of size 'i'
      =<<      -- for each chunk
   transpose   --   transpose
 c.            --   and split into chunks of size 'i', again
               -- flatten one level of nesting ('=<<' is concatMap)
(m!n)i=        -- main function
    i#m\\i#n   -- remove every element of i#n from i#m
      ==[]     -- and check if it results in an empty list  
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 178 bytes
```
(a,b,n)=>{string[]s(int[][]c){int i=0,l=a.Length,m=l/n;var r=new string[m*m];for(;i<l*l;)r[i/l/n*m+i%l/n]+=c[i/l][i++%l];Array.Sort(r);return r;}return s(a).SequenceEqual(s(b));}
```
[Try it online!](https://tio.run/##hZJda4MwFIbv/RXeFGJ7Vj/7RWphF9vVLga9FBlWbBfQSKNujOJvd0lNq@lqh2D09STv855jXDzFBWleKxqvCS2DMAiht8Iuz9PN3m9QBDughr85FSUj9BCEBZJ1sXHiTzrxLUj9aPqW0EP5CZmfmhR/RUxnPk2@dbktG2ch3ucMYbJOxyk2WEBMXjnOJmTE13Dix0IJAzKZjNIQPzMW/Uy3OSsRMzBLyopRneFaPhUoMqbb5FglNE5ejlWUogLtDAPXDdZM09QkpJ7ZH7bu6wJFSidNvPHVBgdc8GAG8xou4gKWsAIL@MdOlFXAP3biilcuuDgDr1/p8K0WP6JXacP1qrUa99mcATZxTmtw55wbx5aNu/bZrDObcLyKbdU5c/9MB9rMyzPbOx9XifZI9A0EIDi8q3dk@77sClkZgPPfADoYOY8/4TpBzkFto/OgjZ7qIPYrDoJBcRAMcy4ozXBEPHHzlNRSlj1SUruPUisB@Us/jDsYhpMp/0K78QrjChj3MhkFxhuEsdROeoPmN3@HJ8w8adb8Ag "C# (Visual C# Interactive Compiler) – Try It Online")
-1 thanks to @KevinCruijssen!  
-8 thanks to @ceilingcat!
Less golfed code:
```
// anonymous function
// a and b are 2d jagged arrays
// n is the size of the sub matrix
(a,b,n)=>{
  // helper function that translates
  // the sub matrices into strings
  // of digits.
  string[]s(int[][]c){
    // i and j are loop counters
    int i=0,j,
      // l is the size of a side of a matrix
      l=a.Length,
      // m is the number of sub matrices
      // per side of a matrix
      m=l/n;
    // the concatenated digits are
    // stored in a single dimension
    // array
    var r=new string[m*m];
    // flattened loop builds up
    // the digit strings
    for(;i<l*l;)
      r[i/l/n*m+i%l/n]+=c[i/l][i++%l];
    // The resulting array is
    // sorted before it is returned for
    // ease of comparison.
    Array.Sort(r);
    return r;
  }
  return s(a).SequenceEqual(s(b));
}
```
[Answer]
# [PHP](https://php.net/), ~~186~~ ~~163~~ 162 bytes
```
function($a,$b,$n){$f=function($j,$n){foreach($j as$x=>$r)foreach($r as$y=>$v)$o[count($j)*($x/$n|0)+$y/$n|0].=$v;sort($o);return$o;};return$f($a,$n)==$f($b,$n);}
```
[Try it online!](https://tio.run/##pVTbjpswEH0uX@EHP@DWagzhKkr7IQhFNAvNrrKADES7avfb05mxA2hbdZOt/MB45pyZMx6b/tCfv3zrDz2rte70Ttd9p8f79oerRMb11O7GehjzczO1@/G@a11eSf5d8lb85E2@eB/I1XS6rvYH2LJq4E/5V67F7NPoewbfSfCu2HdTOwJQfHT504a3v5T4xJ/JKD/n/JQNoMPlnch0PU665V32cjEbUtGKPEeT1GQv58xxNhsGkll1PDKUPTgOHz2Ws8L5UBSe9OVWBjKUUSmLWCYylUqCF3bWL8ELuxRiMexCGVDMB5QCNMY8Oa@ylJgX44axjl@4Ji/wKa@ivMiVhfGTJuL50mhKytIpM1AevFIOKNvBkhksq9yquRJrKoTvqYB@g0W/wSLfYJEfgWUrRKsKJqfNAjhzWhdkTEgGIWUh80Ekf8pcD0vhcEgOjWp1EKZoSKNEcTjElEaBMcBfKqTrCsuVMLUS@KbUJg4sng8CfBYLvtUYE2oN@dHSnqeWEgpAKHr76j6hrHlRCruouXlRS/Oa2/XolpqsPt3s/8qKsvFBDYduOt4x8/TYqKeawZPGN@Y4p0rv7qbH3mXzrwLM0YMRSvpCdeYzwfLcMEV2Hcd7B2drOE11HP5FCiwpIFJwVaHQcsJ1Q28ViiwpWnf0Fim2pPgWUmJJyS3yUktKbxmSupy4@lup828 "PHP – Try It Online")
Like all good challenges, I started off thinking this was fairly easy and it threw me some curves. Nicely done @Kevin Cruijssen!
Chunks the matrix into strings containing the values for each block. Arrays are then sorted and compared for equality.
Ungolfed:
```
function jigsaw_chunk( $j, $n ) {
    foreach( $j as $x => $r ) {
        foreach( $r as $y => $v ) {
            $o[ count( $j ) * floor( $x/$n ) + floor( $y/$n )] .= $v;
        }
    }
    sort( $o );
    return $o;
}
function jigsaw_test( $a, $b, $n ) {
    return jigsaw_chunk( $a, $n ) == jigsaw_chunk( $b, $n );
}
// Test 6
var_dump( jigsaw_test( [[1,2],[3,4]], [[2,3],[1,1]], 1 ) );
```
Output
```
bool(false)
```
[Answer]
# [Red](http://www.red-lang.org), ~~148~~ ~~147~~ 142 bytes
```
func[a b n][g: func[m][
sort collect[loop k:(length? m)/ n[i: 0
loop k[keep/only
collect[loop n[keep
take/part m/(i: i + 1) n]]]]]](g a)= g b]
```
[Try it online!](https://tio.run/##5VK7coMwEOz1FVvCpOBh/GLGk39Iq1GBsSAMQjCEFPl6ckgyMk6bzlJ1t7e7txqN8jZ/yBsXrMrn6luXvMAVWvA6hyk7wdlXP04oe6VkOXHV9wPaPFBS19PnO7owguZNjphZiLdSDlGv1Q/bcLQB2FS0MhoKUuyigGgN3pCEZGlOUKMIL6hxFfMwNnpCBQ4GOjxBih0y7HEQtnPECWfEIMR1HA5CXOdMM0fq7JGtMykxYmLeZxKsVzAB7ucs@3nuUcv6kd7qFxs/o2U6Fje7C5/E7n5a/FLGXiZr8kJZdw9ZN7ICLroLLlzpMq7wXZ1q8R8S2Z@FPIxnwa3dVn27jn@ABffcRdxzF93DUtGHn38B "Red – Try It Online")
]