Here is a simple LuaTeX/ConTeXt based solution.
\shuffle[nx=..., ny=...]{<box>}
where nx is the number of horizontal slices that you want, and my is the number of vertical slices that you want. The macro is based on \setupclipping and which does the actual hard work of clipping the image. This macro effective generates:
\clip[nx=...,ny=...,x=...,y=...]{<box>}
by randomly varying x and y over all possible values. To generate such x and y, I simply generate all possible values and shuffle the result.
AFAIK, Lua does not have a shuffle function, so I implemented one based on the standard Fisher Yates algorithm.
Here is the result of \shuffle[nx=3,ny=2]{\externalfigure[hacker]} (hacker is one of the sample images distributed with ConTeXt).

And finally, the macro:
\startluacode
local random = math.random
local insert = table.insert
local format = string.format
-- Note that ConTeXt stores the value of the random seed
-- in the tuc file to ensure that you get the random numbers
-- don't change across runs. If you want a different set of random
-- numbers just delete the tuc file and compile again
-- A function to shuffle the contents of a table
local function shuffle_table(data)
-- implementation of Fisher Yates shuffle
local t
for i=#data,1,-1 do
local j = random(1,i)
-- Swap i and j location
t = data[i]
data[i] = data[j]
data[j] = t
end
return data
end
local function shuffle_box(nx, ny, box)
-- Generate table of all possible indices
local indices = {}
for i=1,nx do
for j=1,ny do
insert(indices, {i,j})
end
end
indices = shuffle_table(indices)
-- table.print(indices)
local x, y, settings
context("\\vbox\\bgroup")
context("\\baselineskip\\zeropoint \\lineskip\\zeropoint")
for i = 1,nx do
context("\\hbox\\bgroup") -- This can be frame for more control
for j=1,ny do
x, y = indices[(i-1)*nx+j][2], indices[(i-1)*nx+j][2]
settings = format("nx=%d, ny=%d, x=%d, y=%d", nx, ny, x, y)
-- print(settings)
context.clip({settings}, box)
end
context("\\egroup")
end
context("\\egroup")
end
commands.shuffle = shuffle_box
\stopluacode
\unprotect
\unexpanded\def\shuffle
{\dosingleargument\shuffle_indeed}
\def\????shuffle{@@@@shuffle}
\def\shuffle_indeed[#1]#2% #2 should be some boxed material
{\getparameters[\????shuffle][\c!nx=4,\c!ny=4,#1]%
\ctxcommand{shuffle(\@@@@shufflenx, \@@@@shuffleny, \!!bs #2 \!!es)}}
\starttext
\shuffle[nx=3,ny=3]{\externalfigure[cow]}
\stoptext