# How do convolution layers work?

So let's say I have a 4x4 image with 3 channels. So we have 3 4x4 matrices where each matrix represents a channel. Now let's say I also have a 3x3 kernel. I know that for convolution layers, I have to slide the kernel over the image and take the dot product. So for two 3x3 matrices, would I perform matrix multiplication and take the sum and do I need to perform this convolution for each image and then add them together?

For my example, if the images were

4, 23, 1, 0
3, 0, 10, 2
3, 71, 8, 2
3, 5, 16, 7

1, 15, 6, 1
6, 1, 6, 4
10, 21, 2, 1
7, 2, 4, 3

7, 4, 0, 1
3, 0, 10, 14
6, 7, 6, 3
5, 1, 6, 9

and the kernel was

1, 17, 9
10, 3, 6
13, 4, 2

then what would be the output values?