Find the Cell's Neighbours ...or Toroidal Moore Neighbourhoods

Given positive integers h, w and a non-negative  integer i, return all of the indices surrounding i.

You are to assume a matrix consisting of h rows of w elements, numbered from lowest, in the top left-hand corner, to highest, in the bottom right-hand corner, and return, in any reasonable format, a list of the indices that would surround the index, i. This matrix is a torus (an infinite map that wraps around each edge).

For example, inputs h=4 and w=4, would result in the matrix:

 0  1  2  3 
 4  5  6  7
 8  9 10 11
12 13 14 15


but more specifically:

15 12 13 14 15 12
 3  0  1  2  3  0
 7  4  5  6  7  4
11  8  9 10 11  8
15 12 13 14 15 12
 3  0  1  2  3  0

so that if i was 0, you'd need to return 15, 12, 13, 3, 1, 7, 4, 5 (0-based).

Examples

0-based:

h   w   i       Expected result

4   4   5       0, 1, 2, 4, 6, 8, 9, 10
4   4   0       15, 12, 13, 3, 1, 7, 4, 5
4   5   1       15, 16, 17, 0, 2, 5, 6, 7
1   3   2       1, 2, 0, 1, 0, 1, 2, 0
1   1   0       0, 0, 0, 0, 0, 0, 0, 0


1-based:

h   w   i       Expected result

4   4   6       1, 2, 3, 5, 7, 9, 10, 11
4   4   1       16, 13, 14, 4, 2, 8, 5, 6
4   5   2       16, 17, 18, 1, 3, 6, 7, 8
1   3   3       2, 3, 1, 2, 1, 2, 3, 1
1   1   1       1, 1, 1, 1, 1, 1, 1, 1


Rules


Your answer may be 0 or 1-indexed, your choice, please specify.
You can assume that i &lt; h * w (or i &lt;= h * w for 1-indexed answers).
You can assume that i &gt;= 0 (or i &gt; 0 for 1-indexed answers).
The order of the returned values is not important as long as just the eight desired values are included.
Standard loopholes are forbidden.
This is code-golf so the shortest answer, in each language, wins!


Thanks to @Conor O'Brien for the more technical sounding title and @ngm for more test cases!
JavaScript (ES6), 75 bytes
Saved 2 bytes thanks to @KevinCruijssen
Expects a 0-based index.

(h,w,i)=&gt;[...'12221000'].map((k,j,a)=&gt;(i+w+~-k)%w+~~(i/w+h+~-a[j+2&amp;7])%h*w)

Try it online!
The surrounding indices are returned in the following order:
$$\begin{matrix}5&amp;4&amp;3\\6&amp;\cdot&amp;2\\7&amp;0&amp;1\end{matrix}$$
How?
The indices \$I_{dx,dy}\$ of each surrounding cell at \$(x+dx,y+dy)\$ are given by:
$$\begin{align}I_{dx,dy}&amp;=((x+dx) \bmod w)+w((y+dy) \bmod h)\\&amp;=((N+dx) \bmod w)+w((\left\lfloor\frac{N}{w}\right\rfloor+dy) \bmod h)\end{align}$$
where \$N=wy+x\$ is the index of the target cell.
We walk through the list \$[1,2,2,2,1,0,0,0]\$ and subtract \$1\$ to get the value of \$dx\$, which gives:
$$[0,1,1,1,0,-1,-1,-1]$$
For the corresponding values of \$dy\$, we use the same list shifted by 2 positions, which gives:
$$[1,1,0,-1,-1,-1,0,1]$$