I am working on a simple puzzle yet I am totally confused how I should approach the whole thing, because I am new to Unity but I have basic/advanced programming experience.
What I would like to do is:
The pieces are moved using the mouse
I would like the pieces scattered on the table at start
Pieces should snap to the grid but it must not hang out of the grid or the screen
I think you should start out with step 1. Find out how to take mouse input from the user and learn how it works. Once you learn how it works, it will make much more sense to you, then you can apply your knowledge. Then once you solve your problem. Move to step 2.
You will most likely need to create some sort of PuzzleManager class that manages each puzzle peice and their rules. Some good old OOP can be used also, along with polymorphism to separate specific behaviors based on each different puzzle piece.
But, for a simple solution:
The board squares can be separated into individual collision 2d boxes. You could also split the puzzle piece into squares, which individual collision boxes put together. Then, once all collision boxes for the puzzle peice collide with one on the board, all at once using OnCollisionEnter2D, then update the position of the puzzle piece to your desired location. This will create the snap effect.